Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS-4838 Audit Log improvements #1042

Merged
merged 4 commits into from
Sep 14, 2023

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Sep 8, 2023

Description

While writing the audit log doc canonical/jaas-documentation#21, it was found that several improvements could be made and some bugs fixed.

  • Add omitempty to various audit log fields to make the returned list clearer
  • Fixed bug in the CLI where the offset field was never set.
  • Fixed a bug in the CLI where the purgelogs command didn't work
  • Add conversationID to all model requests
  • Fix audit log cleanup job logic

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

@@ -17,6 +17,7 @@ import (
"github.com/canonical/jimm/internal/auth"
"github.com/canonical/jimm/internal/dbmodel"
"github.com/canonical/jimm/internal/errors"
"github.com/canonical/jimm/internal/jimm"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, not sure how I feel about bring internal/jimm as a dependency in this package, it's only for the jimm.NewConversationID() function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the NewConversationID into a utils package

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use juju's new convo id func? If it's exported*

Copy link
Contributor Author

@kian99 kian99 Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not exported https://github.com/juju/juju/blob/3.2/core/auditlog/auditlog.go#L176 (it's a very simple function that doesn't need to change when Juju changes, so I figured it's okay in this case to just copy-paste it)
I'll move it into a utils package.

Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

cmd/jimmctl/cmd/purge_logs.go Show resolved Hide resolved
internal/jimm/audit_log.go Show resolved Hide resolved
@@ -17,6 +17,7 @@ import (
"github.com/canonical/jimm/internal/auth"
"github.com/canonical/jimm/internal/dbmodel"
"github.com/canonical/jimm/internal/errors"
"github.com/canonical/jimm/internal/jimm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use juju's new convo id func? If it's exported*

- Created new utils package
@kian99 kian99 merged commit 161d01d into canonical:feature-rebac Sep 14, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants